var express = require('express');
var router = express.Router();
var QuestModel = require('../db/questModel')

module.exports = function (req, res) {
    var openCode = req.params.opencode
    QuestModel.findOne({openCode: openCode}, function (error, quest) {
        if (quest) {
            res.send({
                title: quest.title,
                description: quest.description,
                id:quest.id,
                questions: quest.questions,
                endtime:quest.endTime
            })
        } else {
            res.status(400).send({
                status: 400,
                message: "问卷不存在"
            })
        }
    })
}